using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace WPCoco.Tasks
{
    public class ScaleTo : TargetedTask<IAffine>
    {
        public ScaleTo(Vector2 scale, float duration)
            : base(duration)
        {
            this.scale = scale;
        }

        Vector2 scale;
        Vector2 delta;
        Vector2 start;

        public override void InitializeWithTarget(IAffine target)
        {
            start = target.Scale;
            delta = (scale - start) / Duration;
        }

        public override void UpdateWithTarget(IAffine target, float time)
        {
            target.Scale = start + delta * time;
        }

        public override Task Clone()
        {
            return new ScaleTo(scale, Duration);
        }
    }
}
